/**
 * @class UI-基础件-状态栏
 * @author DuskyHuang 圣子
 * @description 当前只是包含了镜头状态的显示，后续可以在这里加入更多UI显示。
*/

import { _decorator, Node } from 'cc';
import { Mediator } from 'cfw';
import { updateSwitcherLayout } from 'helpers';
import { UI } from 'notifications';
const { ccclass, property } = _decorator;

@ccclass('cocosmos.state-bar')
export class StateBar extends Mediator {

    @property(Node) lensHover: Node = null;
    @property(Node) lensPitch: Node = null;
    @property(Node) lensZoom: Node = null;
    @property(Node) lensLock: Node = null;
    @property(Node) listLens: Node = null;

    protected onLoad(): void {
        this._init();
    }

    private _init(): void {
        this.on(UI.LENS_PARAMS, this.onLensPanelParams);
        this.listLens.children.forEach(child => child.active = false);
    }
    protected start(): void {
        updateSwitcherLayout(this.listLens);
    }

    protected onLensPanelParams(params: LensPanelParams): void {
        const { hover, pitch, zoom, lock } = params;
        this.lensHover.active = hover;
        this.lensPitch.active = pitch;
        this.lensZoom.active = zoom;
        this.lensLock.active = lock;
        updateSwitcherLayout(this.listLens);
    }
}